import * as constant from './constant'
import axios from 'axios'
const getLoginData = () => ({
   type: constant.GET_LOGIN_DATA,
   value: true
})
export const logout = () => ({
    type: constant.LOGOUT_DATA,
    value: false
})
export const getLogin = (account, passwd) => {
    return (dispatch) => {
        axios.get('/api/login.json?+account' + account + '&passwd' + passwd)
        .then( (res)=>{
         const result = res.data.data;
         console.log(result);
         dispatch( getLoginData())
        })
        .catch((res) => {
          alert('登录失败')
        })
       
    }
}